<?php
$userName = $_POST['name'] ?? '';
$passWord = $_POST['pw'] ?? '';
$dns = "sqlsrv:Server=LAPTOP-LD8O4C6L\SQLEXPRESS;Database=TaskManagement";
$db = new PDO($dns,"sa","123456");
$sql = "select * from Admin";
$result = $db->query($sql);
$userInfo = $result->fetchAll(PDO::FETCH_ASSOC);
foreach ( $userInfo as $key =>$value) {
    if ($value['AdminAccount']==$userName&&$value['AdminPassword']==$passWord){
        echo '登录成功'.'<a href="task_list.php">跳转到管理员页面</a>';
    }
}

?>